public class TopK {

    public static void main(String[] args) {
        int[] array = {89, 3, 234, 332, 56, 43, 6, 1};

        insertSort(array);
        heapSort(array);
    }


    public static void insertSort(int[] arrays) {
        int j;
        for (int p = 1; p < arrays.length; p++) {
            int temp = arrays[p];
            for (j = p; j > 0 && temp < arrays[j - 1]; j--) {
                //
                arrays[j] = arrays[j - 1];
            }
            arrays[j] = temp;
        }
    }


    public static void heapSort(int[] array) {
        for (int i = array.length / 2 - 1; i >= 0; i--) {
            percDown(array, i, array.length);
        }
    }

    private static void percDown(int[] array, int i, int length) {
        int temp;
        int child;
    }

    private static int leftChild(int i) {
        return i * 2 + 1;
    }


    public static void removeDuplicate(int[] array) {
        int lenght=array.length;
        for (int i = 0; i <lenght; i++) {

        }

    }


}
